<?php $this->display('header') ?>
<link href="{$_W['siteroot']}../addons/{MOD_ADD}/static/admin/H/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
    <!--左侧导航开始-->
    <?php $this->display('menu') ?>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <?php $this->display('header_top') ?>
            <div class="row wrapper border-bottom white-bg page-heading">
                <form action="{php echo gWebUrl('user/lists')}" method="post" class="form-horizontal" role="form"  id="formdata">
                    <div class="ibox float-e-margins">
                        <div class="col-xs-2">
                            <div class="input-daterange input-group">
                                <input type="text" class="form-control layer-date" placeholder="请输入昵称" name="nickname" value="{$_GPC['nickname']}">
                            </div>
                        </div>
                        <div class="col-xs-2">
                            <div class="input-daterange input-group">
                                <input type="text" class="form-control layer-date" placeholder="请输入手机号" name="mobile" value="{$_GPC['mobile']}">
                            </div>
                        </div>
                        <div class="col-xs-2">
                            <input type="button" class="btn btn-primary" value="搜索" onClick="tpform('{php echo gWebUrl('user/lists')}')">
                        </div>
                    </div>
                </form>
            </div>
            <div id="table">
                <table class="table table-striped table-bordered table-hover m-t-md">
                    <thead>
                    <tr>
                        <th >
                            <label for="batch_input"><input id="batch_input" type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" /></label>
                        </th>
                        <th class="text-center">编号ID</th>
                        <th class="text-center">头像</th>
                        <th class="text-center">昵称</th>
                        <th class="text-center">手机号</th>
                        <th class="text-center">累计消费</th>
                        <th class="text-center">添加时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $aData['data'] $k $v}
                    <tr>
                        <td>
                            <input type="checkbox" name="checkbox[]" class="checkbox" value="{$v['code_id']}" />
                        </td>
                        <td class="text-center">{php echo ((max(1, intval($_GPC['page']))-1)*10)+$k+1}</td>
                        <td class="text-center"><a href="{php echo $v['avatar']}"  title="图片" data-gallery=""><img  width="40" height="40" src="{php echo $v['avatar']}"></a></td>
                        <td class="text-center">{$v['nickname']}</td>
                        <td class="text-center">{$v['mobile']}</td>
                        <td class="text-center">{$v['consumption']}</td>
                        <td class="text-center">{php echo date('Y-m-d H:i',$v['creation_date'])}</td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
                {$aData['page']}
            </div>
    </div>
    <!--右侧部分结束-->
</div>
<script src="{$_W['siteroot']}../addons/{MOD_ADD}/static/admin/H/js/plugins/jeditable/jquery.jeditable.js"></script>

<script type="text/javascript">
    document.querySelectorAll('.js-delete')[0].onclick = () => {
        var ids = [];
        var $checks = $('.checkbox:checkbox:checked');
        $checks.each(function () {
            if (this.checked) {
                ids.push(this.value);
            }
            ;
        });
        if (ids.length == 0) {
            layer.alert('请至少选择一个', {icon: 5});
            return;
        }
        layer.confirm('确定执行操作吗', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            const u = "{php echo gWebUrl('code/del_all')}";
            $.post(u, {ids: ids}, function (data) {
                if (data.type == 'success') {
                    layer.alert(data.message, {icon: 1});
                    setTimeout(function () {
                        window.location.reload()
                    }, 1000);
                } else {
                    layer.alert(data.message, {icon: 5});
                    setTimeout("_postUrl('" + data.redirect + "')", 1000);
                }
            });

        }, function () {
            // 取消操作
        });
    }
</script>
<?php $this->display('foot') ?>
